<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
// Auth
$router->group(['prefix' => 'auth','namespace' => 'Auth'], function () use ($router) {
    $router->post('/login', 'LoginController@login');
});

// OAuth
$router->group(['prefix' => 'oauth2','namespace' => 'OAuth'], function () use ($router) {
    
});

// Client
$router->group(['prefix' => 'client','namespace' => 'Client'], function () use ($router) {
    $router->post('/login', 'LoginController@login');
    $router->post('/register', 'RegisterController@store');
});

// Token
$router->group(['prefix' => 'token','namespace' => 'Token'], function () use ($router) {
    $router->get('/app', 'AppTokenController@issueToken');
});

// Notify
$router->group(['prefix' => 'notify','namespace' => 'Notify'], function () use ($router) {
    // Pay
    $router->group(['prefix' => '/site/pay','namespace' => 'SitePay'], function () use ($router) {
        $router->get('/ease/sync', 'PayEaseController@handleSync');
        $router->get('/ease/async', 'PayEaseController@handleAsync');
    });
});

// Dict
$router->group([
    'prefix' => 'dict',
//    'middleware' => [
//        'app-auth:app_site',
//        'app-authorize'
//    ],
    'namespace' => 'Dict'
], function () use ($router) {

    $router->group(['prefix' => 'countries'], function () use ($router) {
        $router->get('/', 'CountryController@index');
    });

    $router->group(['prefix' => 'currencies'], function () use ($router) {
        $router->get('/', 'CurrencyController@index');
    });

    $router->group(['prefix' => 'titles'], function () use ($router) {
        $router->get('/', 'TitleController@index');
    });

    $router->group(['prefix' => 'genders'], function () use ($router) {
        $router->get('/', 'GenderController@index');
    });

    $router->group(['prefix' => 'order', 'namespace' => 'Order'], function () use ($router) {
        $router->get('/status', 'OrderStatusController@index');
    });

    $router->group(['prefix' => 'paper', 'namespace' => 'Paper'], function () use ($router) {
        $router->get('/status', 'PaperStatusController@index');
        $router->get('/abstract/status', 'AbstractStatusController@index');
        $router->get('/full/status', 'FullStatusController@index');
        $router->get('/presentation-preferences', 'PresentationPreferenceController@index');
    });
});